package com.hm.hsw;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        ArrayList<String> list1 = new ArrayList<>();
        ArrayList<Person> list2 = new ArrayList<>();
        ArrayList<Student> list3 = new ArrayList<>();
        ArrayList<JavaStudent> list4 = new ArrayList<>();
        ArrayList<UIStudent> list5 = new ArrayList<>();
        ArrayList<Teacher> list6 = new ArrayList<>();
        ArrayList<JavaTeacher> list7 = new ArrayList<>();
        ArrayList<UITeacher> list8 = new ArrayList<>();
        print1(list1);
        print2(list2);


    }
    //参数可以接收任何泛型
    public static void print1(ArrayList<?>list){
        System.out.println(list);
    }
    //可以接收Person及其子类泛型
    public static void print2(ArrayList<?extends Person>list){
        System.out.println(list);
    }
    //接收Student及其子类泛型
    public static void print3(ArrayList<?extends Student>list){
        System.out.println(list);
    }
    //可以接收任何Java学员
    public static void print4(ArrayList<?extends JavaStudent>list){
        System.out.println(list);
    }

}
